var t = require("../../../mycomponent/yz_pay/yz_pay"), a = getApp();

Page({
    behaviors: [ t ],
    data: {
        language: "",
        isclick: !0,
        order_id: "",
        store_id: "",
        orderData: null,
        balance: 0,
        payParams: "",
        info_form: {},
        order_sn: "",
        money: "",
        buttons: [],
        pay_sn: "订单编号",
        order_pay_id: "",
        uid: "",
        pid: "",
        status: ""
    },
    onLoad: function(t) {
        var o = this;
        if (console.log("options:", t), !t.datas) return wx.showToast({
            title: "缺少支付参数",
            icon: "success",
            duration: 1e3
        }), void wx.navigateBack({
            delta: 1
        });
        this.setData({
            info_form: JSON.parse(t.datas)
        });
        var e = a.getNetAddresss("plugin.luck-draw.frontend.team.getPayType");
        a._getNetWork({
            url: e,
            success: function(t) {
                var a = t.data.data;
                console.log("PayResult::::", a), 1 == t.data.result ? (o.hanleIcon(a), o.setData({
                    buttons: a.buttons
                })) : (wx.showToast({
                    title: t.data.msg,
                    icon: "success",
                    duration: 2e3
                }), console.log("错误", t.data.msg));
            },
            fail: function(t) {
                console.log("===============", t);
            }
        });
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    fromChild: function(t) {
        if ("0.00" == this.data.money) this.sureBtn(); else {
            var a = t.detail.submitArr;
            this.confirm(a);
        }
    },
    confirm: function(t) {
        var a = t;
        this.surePay(a);
    },
    surePay: function(t) {
        var o = this, e = {
            activity_id: this.data.info_form.activity_id,
            total: this.data.info_form.total,
            pay_id: t.value,
            money: this.data.info_form.money * this.data.info_form.total,
            pid: this.data.info_form.pid || 0,
            address: this.data.info_form.address,
            client_type: 2
        }, s = a.getNetAddresss("plugin.luck-draw.frontend.team.payJoinActivity");
        a._getNetWork({
            url: s,
            data: e,
            success: function(a) {
                var e = a.data;
                1 == e.result ? o.handleOtherPay(t, t.value, e.data) : wx.showToast({
                    title: e.msg,
                    icon: "none",
                    duration: 2e3,
                    success: function() {}
                });
            },
            fail: function(t) {
                console.log(t, "错误");
            }
        });
    }
});